﻿Public Class frm_principal

    Private Sub SairToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SairToolStripMenuItem.Click
        If (MessageBox.Show("Deseja Sair do Sistema?", "Sair", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) = Windows.Forms.DialogResult.Yes Then
            Me.Close()
        End If
    End Sub

    Private Sub SeguroToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub HistóricoDeCargasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim frm As New frm_cadastro_historico_carga
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub MarcasToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles Marcas.Click
        Dim frm As New frm_cadastro_marcas
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub ModelosToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles Modelos.Click
        Dim frm As New frm_cadastro_modelos
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub FuncionáriosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Funcionarios.Click
        Dim frm As New frm_cadastro_funcionarios
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub ClientesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Clientes.Click
        Dim frm As New frm_cadastro_clientes
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub TiposDeCargasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TiposdeCargas.Click
        Dim frm As New frm_cadastro_tipos_cargas
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub CargasToolStripMenuItem1_Click(sender As System.Object, e As System.EventArgs) Handles Cargas.Click
        Dim frm As New frm_cadastro_cargas
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub HistóricoDeCargasToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles histCargas.Click
        Dim frm As New frm_cadastro_historico_carga
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub SegurosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Seguros.Click
        Dim frm As New frm_cadastro_seguros
        frm.ShowDialog()
        frm = Nothing
    End Sub


    Private Sub RotasToolStripMenuItem1_Click(sender As System.Object, e As System.EventArgs)
        Dim frm As New frm_cadastro_rotas
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub UsuáriosToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles Usuarios.Click
        Dim frm As New frm_cadastro_usuarios
        frm.ShowDialog()
        frm = Nothing
    End Sub


    Private Sub OrdemDeServiçoToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OrdemdeServiço.Click
        Dim frm As New frm_movimentacao_ordemServico
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub CargasToolStripMenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CargasToolStripMenuItem3.Click
        Dim frmRecursos As New frm_relatorio
        Dim rtp As New rel_cargas
        Try

            frmRecursos.crvRelatorios.ReportSource = rtp
            frmRecursos.ShowDialog()
        Catch ex As Exception
            MessageBox.Show("Erro", "Relatório", MessageBoxButtons.OK)
        End Try
        frmRecursos.Dispose()
        rtp = Nothing
    End Sub

    Private Sub TiposDeCargaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TiposDeCargaToolStripMenuItem.Click
        Dim frmRecursos As New frm_relatorio
        ' Dim rtp As New rel_tipos_carga
        'Try
        '    frmRecursos.crvRelatorios.ReportSource = rtp
        '    frmRecursos.ShowDialog()
        'Catch ex As Exception
        '    MessageBox.Show("Erro", "Relatório", MessageBoxButtons.OK)
        'End Try
        'frmRecursos.Dispose()
        'rtp = Nothing
    End Sub

    Private Sub HistóricoDeCargaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HistóricoDeCargaToolStripMenuItem.Click
        Dim frmRecursos As New frm_relatorio
        Dim rtp As New rel_historico_cargas
        Try
            frmRecursos.crvRelatorios.ReportSource = rtp
            frmRecursos.ShowDialog()
        Catch ex As Exception
            MessageBox.Show("Erro", "Relatório", MessageBoxButtons.OK)
        End Try
        frmRecursos.Dispose()
        rtp = Nothing
    End Sub

    Private Sub SegurosToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SegurosToolStripMenuItem1.Click
        Dim frmRecursos As New frm_relatorio
        Dim rtp As New rel_seguros
        Try
            frmRecursos.crvRelatorios.ReportSource = rtp
            frmRecursos.ShowDialog()
        Catch ex As Exception
            MessageBox.Show("Erro", "Relatório", MessageBoxButtons.OK)
        End Try
        frmRecursos.Dispose()
        rtp = Nothing
    End Sub

    Private Sub VeículosToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles Veiculos.Click
        Dim frm As New frm_cadastro_frotas
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub AgendamentoDeCargasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AgendamentodeCargas.Click
        Dim frm As New frm_agendamento_carga
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub CombustíveisToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Combustiveis.Click
        Dim frm As New frm_cadastro_combustiveis
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub ContasAPagarToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ContasaPagar.Click
        Dim frm As New frm_contas_a_pagar
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub ControleDeAbastecimentosToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ControleDeAbastecimentos.Click
        Dim frm As New frm_cadastro_combustivel
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub AbastecimentosToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles AbastecimentosToolStripMenuItem.Click
        Dim frm As New frm_parametros
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub ContasAReceberToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ContasdReceber.Click
        Dim frm As New frm_contas_a_receber
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub FuncionariosToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles FuncionariosToolStripMenuItem.Click
        Dim frm As New frm_relatorio
        Dim rtp As New rel_funcionarios
        Try
            frm.Text = "Relátorio de Funcionários"
            frm.crvRelatorios.ReportSource = rtp
            frm.ShowDialog()
        Catch ex As Exception
            MessageBox.Show("Erro", "Relatório", MessageBoxButtons.OK)
        End Try
        frm.Dispose()
        rtp = Nothing
    End Sub

    Private Sub RotasToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles Rotas.Click
        Dim frm As New frm_cadastro_rotas
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub ContasAPagarToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ContasAPagarToolStripMenuItem.Click
        'CAP    CAR CP CR EX
        Dim frm As New frm_RelacaoFinanceiro
        Dim rpt As New rel_ContasApagar
        Try
            frm.CONTROLE = "CAP"
            frm.ShowDialog()
        Catch ex As Exception
            MessageBox.Show("Erro", "Relatório de Recursos", MessageBoxButtons.OK)
        End Try
        frm.Dispose()
        rpt = Nothing
    End Sub

    Private Sub ContasAReceberToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ContasAReceberToolStripMenuItem.Click
        'CAP    CAR CP CR EX
        Dim frm As New frm_RelacaoFinanceiro
        Dim rpt As New rel_contasAreceber
        Try
            frm.CONTROLE = "CAR"
            frm.ShowDialog()
        Catch ex As Exception
            MessageBox.Show("Erro", "Relatório de Recursos", MessageBoxButtons.OK)
        End Try
        frm.Dispose()
        rpt = Nothing
    End Sub

    Private Sub ContasPagasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ContasPagasToolStripMenuItem.Click
        'CAP    CAR CP CR EX
        Dim frm As New frm_RelacaoFinanceiro
        Dim rpt As New rel_contasPagas
        Try
            frm.CONTROLE = "CP"
            frm.ShowDialog()
        Catch ex As Exception
            MessageBox.Show("Erro", "Relatório de Recursos", MessageBoxButtons.OK)
        End Try
        frm.Dispose()
        rpt = Nothing
    End Sub

    Private Sub ContasRecebidasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ContasRecebidasToolStripMenuItem.Click
        'CAP    CAR CP CR EX
        Dim frm As New frm_RelacaoFinanceiro
        Dim rpt As New rel_contasRecebidas
        Try
            frm.CONTROLE = "CR"
            frm.ShowDialog()
        Catch ex As Exception
            MessageBox.Show("Erro", "Relatório de Recursos", MessageBoxButtons.OK)
        End Try
        frm.Dispose()
        rpt = Nothing
    End Sub

    Private Sub ExtratoFinanceiroToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExtratoFinanceiroToolStripMenuItem.Click
        'CAP    CAR CP CR EX
        Dim frm As New frm_RelacaoFinanceiro
        Dim rpt As New rel_extratoFinanceiro
        Try
            frm.CONTROLE = "EX"
            frm.ShowDialog()
        Catch ex As Exception
            MessageBox.Show("Erro", "Relatório de Recursos", MessageBoxButtons.OK)
        End Try
        frm.Dispose()
        rpt = Nothing
    End Sub

    Private Sub FichaDoCaminhãoToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles FichaDoCaminhãoToolStripMenuItem.Click
        'Zitelli  22/11/2012
        'Chamada da tela frm_parametro_placa referente ao relatório de ficha do caminhão
        Try
            Dim frm As New frm_parametro_placa
            frm.ShowDialog()
            frm = Nothing
        Catch ex As Exception
            MessageBox.Show("Erro", "Relatório de Recursos", MessageBoxButtons.OK)
        End Try

    End Sub

    Private Sub AjudaToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles AjudaToolStripMenuItem.Click
        'Zitelli 22/11/2012
        'Chamada do manual do sistema
        Try
            Dim ajuda As String
            ajuda = Application.StartupPath
            ajuda = ajuda.Replace("\bin\Debug", "")
            ajuda = ajuda & "\Arquivo de Ajuda\index.html"
            Dim Ie As Object
            Ie = CreateObject("InternetExplorer.Application")
            Ie.Visible = True
            Ie.Navigate(ajuda)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Erro")
        End Try
    End Sub

    Private Sub OcorrênciasNegativasToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OcorrênciasNegativasToolStripMenuItem.Click
        Try
            Dim frm As New frm_Parametro_Data
            frm.ShowDialog()
            frm = Nothing
        Catch ex As Exception
            MessageBox.Show("Erro", "Relatório de Recursos", MessageBoxButtons.OK)
        End Try
    End Sub

    Private Sub EscaladeOperações_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EscaladeOperações.Click
        Dim frm As New frm_movimentacao_escalaoperacoes
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub LotacaodoVeiculo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LotacaodoVeiculo.Click
        Dim frm As New frm_lotacao_veiculo
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub RotasToolStripMenuItem_Click_1(sender As System.Object, e As System.EventArgs) Handles RotasToolStripMenuItem.Click
        Dim frmRecursos As New frm_relatorio
        Dim rtp As New rel_Rotas
        Try
            frmRecursos.crvRelatorios.ReportSource = rtp
            frmRecursos.ShowDialog()
        Catch ex As Exception
            MessageBox.Show("Erro", "Relatório", MessageBoxButtons.OK)
        End Try
        frmRecursos.Dispose()
        rtp = Nothing
    End Sub

    Private Sub UsuáriosToolStripMenuItem_Click_1(sender As System.Object, e As System.EventArgs) Handles UsuáriosToolStripMenuItem.Click
        Dim frmRecursos As New frm_relatorio
        Dim rtp As New rel_usuarios
        Try

            frmRecursos.crvRelatorios.ReportSource = rtp
            frmRecursos.ShowDialog()
        Catch ex As Exception
            MessageBox.Show("Erro", "Relatório", MessageBoxButtons.OK)
        End Try
        frmRecursos.Dispose()
        rtp = Nothing

    End Sub

    Private Sub DisponivelToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DisponivelToolStripMenuItem.Click
        Dim frmRecursos As New frm_relatorio
        Dim rtp As New rel_carro_dis
        Try
            frmRecursos.crvRelatorios.ReportSource = rtp
            frmRecursos.ShowDialog()
        Catch ex As Exception
            MessageBox.Show("Erro", "Relatório", MessageBoxButtons.OK)
        End Try
        frmRecursos.Dispose()
        rtp = Nothing
    End Sub

    Private Sub IndisponivelToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IndisponivelToolStripMenuItem.Click
        Dim frmRecursos As New frm_relatorio
        Dim rtp As New rel_carro_ind
        Try
            frmRecursos.crvRelatorios.ReportSource = rtp
            frmRecursos.ShowDialog()
        Catch ex As Exception
            MessageBox.Show("Erro", "Relatório", MessageBoxButtons.OK)
        End Try
        frmRecursos.Dispose()
        rtp = Nothing
    End Sub

    Private Sub PessoaFisicaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PessoaFisicaToolStripMenuItem.Click
        Dim frmRecursos As New frm_relatorio
        Dim rtp As New rel_pessoa_fs
        Try
            frmRecursos.crvRelatorios.ReportSource = rtp
            frmRecursos.ShowDialog()
        Catch ex As Exception
            MessageBox.Show("Erro", "Relatório", MessageBoxButtons.OK)
        End Try
        frmRecursos.Dispose()
        rtp = Nothing
    End Sub

    Private Sub PessoaJuridicaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PessoaJuridicaToolStripMenuItem.Click
        Dim frmRecursos As New frm_relatorio
        Dim rtp As New rel_pessoa_jur
        Try
            frmRecursos.crvRelatorios.ReportSource = rtp
            frmRecursos.ShowDialog()
        Catch ex As Exception
            MessageBox.Show("Erro", "Relatório", MessageBoxButtons.OK)
        End Try
        frmRecursos.Dispose()
        rtp = Nothing
    End Sub

    Private Sub LotaçãoDeCaminhãoToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles LotaçãoDeCaminhãoToolStripMenuItem.Click
        Dim frm As New frm_rel_lotacao_caminhao
        frm.ShowDialog()
        frm = Nothing
    End Sub

    Private Sub ClienteToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripMenuItem3.Click
        Dim frmRecursos As New frm_relatorio
        Dim rtp As New rel_clientes
        Try
            frmRecursos.crvRelatorios.ReportSource = rtp
            frmRecursos.ShowDialog()
        Catch ex As Exception
            MessageBox.Show("Erro", "Relatório", MessageBoxButtons.OK)
        End Try
        frmRecursos.Dispose()
        rtp = Nothing
    End Sub

    Private Sub DestinosDeCargasToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles DestinosDeCargasToolStripMenuItem.Click
        Dim frm As New frm_rel_dest_contratados
        frm.ShowDialog()
        frm = Nothing
    End Sub
End Class
